import scrapy
from time import sleep

class Spider(scrapy.Spider):
    name = 'demo'
    allowed_domains = []


    def start_requests(self):

        url = 'https://www.8684.cn/ip'
        headers = {
                "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36"
            }
        for i in range(4):
            sleep(1)
            yield scrapy.Request(url=url, callback=self.parse,headers=headers, dont_filter=True)

    def parse(self,response):
        ip_name = response.xpath('/html/body/div[2]/div/div[3]/form/div[2]/div')
        print(ip_name)

if __name__ == '__main__':
    from scrapy import cmdline

    cmdline.execute('scrapy crawl demo'.split(' '))